package com.guslegend.util;

import java.text.DecimalFormat;
import java.util.Random;

/**
 * @author: guslegend
 * @description: 随机数工具类
 * @create: 2025-05-27 12:13
 **/
public class RandomUtil {
    private static final Random random = new Random();
    private static final DecimalFormat fourdf = new DecimalFormat("0000"); // 4位验证码
    private static final DecimalFormat sixdf = new DecimalFormat("000000"); // 6位验证码

    public static String getFourBitRandom() {
        return fourdf.format(random.nextInt(10000));
    }

    public static String getSixBitRandom() {
        return sixdf.format(random.nextInt(1000000));
    }
}